<#-- 变量声明 -->
<#assign
<#-- 源表名 -->
source_tablename = source.sourceDbtableName
<#-- 目的表名 -->
destination_tablename = source.destinationDbtableName
<#-- 资源库相对路径 -->
resourcelibrary_relativepath = source.resourcelibraryRelativepath
<#-- 时间变量，格式 yyyy/mm/dd HH24:mi:ss -->
create_time = source.createTime
<#-- 源数据库名称 -->
source_dbname = source.sourceDbname
<#-- 目的数据库名称 -->
destination_dbname = source.destinationDbname
<#-- 源表查询SQL -->
sourcetable_sql = source.sourcetableSql
<#-- 源数据库类型 -->
source_dbtype = source.sourceDbtype
<#-- 目的数据库类型 -->
destination_dbtype = source.destinationDbtype
>
<?xml version="1.0" encoding="UTF-8"?>
<transformation>
    <info>
        <name>同步${source_tablename}到${destination_tablename}</name>
        <description/>
        <extended_description/>
        <trans_version/>
        <trans_type>Normal</trans_type>
        <directory>${resourcelibrary_relativepath}</directory>
        <parameters>
        </parameters>
        <log>
            <trans-log-table><connection/>
                <schema/>
                <table/>
                <size_limit_lines/>
                <interval/>
                <timeout_days/>
                <field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field></trans-log-table>
            <perf-log-table><connection/>
                <schema/>
                <table/>
                <interval/>
                <timeout_days/>
                <field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
            <channel-log-table><connection/>
                <schema/>
                <table/>
                <timeout_days/>
                <field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
            <step-log-table><connection/>
                <schema/>
                <table/>
                <timeout_days/>
                <field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
        </log>
        <maxdate>
            <connection/>
            <table/>
            <field/>
            <offset>0.0</offset>
            <maxdiff>0.0</maxdiff>
        </maxdate>
        <size_rowset>10000</size_rowset>
        <sleep_time_empty>50</sleep_time_empty>
        <sleep_time_full>50</sleep_time_full>
        <unique_connections>N</unique_connections>
        <feedback_shown>Y</feedback_shown>
        <feedback_size>50000</feedback_size>
        <using_thread_priorities>Y</using_thread_priorities>
        <shared_objects_file/>
        <error_file_size>10485760</error_file_size>
        <capture_step_performance>N</capture_step_performance>
        <step_performance_capturing_delay>1000</step_performance_capturing_delay>
        <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
        <dependencies>
        </dependencies>
        <partitionschemas>
        </partitionschemas>
        <clusterschemas>
        </clusterschemas>
        <created_user>-</created_user>
        <created_date>${create_time}</created_date>
        <modified_user>-</modified_user>
        <modified_date>${create_time}</modified_date>
    </info>
    <notepads>
        <notepad>
            <note>读数据从表 [${source_tablename}] 位于数据库 [${source_dbname}]
                然后,同步数据到表 [${destination_tablename}] 位于数据库 [${destination_dbname}]</note>
            <xloc>248</xloc>
            <yloc>116</yloc>
            <width>380</width>
            <heigth>40</heigth>
            <fontname>Arial</fontname>
            <fontsize>10</fontsize>
            <fontbold>N</fontbold>
            <fontitalic>N</fontitalic>
            <fontcolorred>0</fontcolorred>
            <fontcolorgreen>0</fontcolorgreen>
            <fontcolorblue>0</fontcolorblue>
            <backgroundcolorred>255</backgroundcolorred>
            <backgroundcolorgreen>165</backgroundcolorgreen>
            <backgroundcolorblue>0</backgroundcolorblue>
            <bordercolorred>100</bordercolorred>
            <bordercolorgreen>100</bordercolorgreen>
            <bordercolorblue>100</bordercolorblue>
            <drawshadow>Y</drawshadow>
        </notepad>
    </notepads>
    <connection>
        <name>${destination_dbname}</name>
        <server>${r'$'}{${destination_dbname}.server}</server>
        <type>${destination_dbtype?upper_case}</type>
        <access>Native</access>
        <database>${r'$'}{${destination_dbname}.database}</database>
        <port>${r'$'}{${destination_dbname}.port}</port>
        <username>${r'$'}{${destination_dbname}.username}</username>
        <password>${r'$'}{${destination_dbname}.password}</password>
        <servername/>
        <data_tablespace/>
        <index_tablespace/>
        <attributes>
            <attribute><code>CONNECTION_RETRY_DELAY</code><attribute>2000</attribute></attribute>
            <attribute><code>CONNECTION_RETRY_TIMES</code><attribute>10</attribute></attribute>
            <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
            <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
            <attribute><code>INITIAL_POOL_SIZE</code><attribute>5</attribute></attribute>
            <attribute><code>MAXIMUM_POOL_SIZE</code><attribute>10</attribute></attribute>
            <attribute><code>PORT_NUMBER</code><attribute>${r'$'}{${destination_dbname}.port}</attribute></attribute>
            <attribute><code>QUOTE_ALL_FIELDS</code><attribute>Y</attribute></attribute>
            <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
            <attribute><code>USE_POOLING</code><attribute>Y</attribute></attribute>
        </attributes>
    </connection>
    <connection>
        <name>${source_dbname}</name>
        <server>${r'$'}{${source_dbname}.server}</server>
        <type>${source_dbtype?upper_case}</type>
        <access>Native</access>
        <database>${r'$'}{${source_dbname}.database}</database>
        <port>${r'$'}{${source_dbname}.port}</port>
        <username>${r'$'}{${source_dbname}.username}</username>
        <password>${r'$'}{${source_dbname}.password}</password>
        <servername/>
        <data_tablespace/>
        <index_tablespace/>
        <attributes>
            <attribute><code>CONNECTION_RETRY_DELAY</code><attribute>2000</attribute></attribute>
            <attribute><code>CONNECTION_RETRY_TIMES</code><attribute>10</attribute></attribute>
            <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
            <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
            <attribute><code>INITIAL_POOL_SIZE</code><attribute>5</attribute></attribute>
            <attribute><code>MAXIMUM_POOL_SIZE</code><attribute>10</attribute></attribute>
            <attribute><code>PORT_NUMBER</code><attribute>${r'$'}{${source_dbname}.port}</attribute></attribute>
            <attribute><code>QUOTE_ALL_FIELDS</code><attribute>Y</attribute></attribute>
            <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
            <attribute><code>USE_POOLING</code><attribute>Y</attribute></attribute>
        </attributes>
    </connection>
    <order>
        <hop> <from>从源表 [${source_tablename}]</from><to>记录合并</to><enabled>Y</enabled> </hop>  <hop> <from>从目的表 [${destination_tablename}]</from><to>记录合并</to><enabled>Y</enabled> </hop>  <hop> <from>内容路由</from><to>插入目的表 [${destination_tablename}]</to><enabled>Y</enabled> </hop>  <hop> <from>内容路由</from><to>更新目的表 [${destination_tablename}]</to><enabled>Y</enabled> </hop>  <hop> <from>内容路由</from><to>空操作</to><enabled>Y</enabled> </hop>  <hop> <from>插入目的表 [${destination_tablename}]</from><to>插入日志表 [${destination_tablename}_LOG]</to><enabled>N</enabled> </hop>  <hop> <from>更新目的表 [${destination_tablename}]</from><to>插入日志表 [${destination_tablename}_LOG]</to><enabled>N</enabled> </hop>  <hop> <from>记录合并</from><to>内容路由</to><enabled>Y</enabled> </hop>  </order>
    <step>
        <name>从源表 [${source_tablename}]</name>
        <type>TableInput</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <connection>${source_dbname}</connection>
        <sql>${sourcetable_sql}
ORDER BY <#list keyMap?keys as key><#if key_index == 0>${key}<#else>, ${key}</#if></#list></sql>
        <limit>0</limit>
        <lookup/>
        <execute_each_row>N</execute_each_row>
        <variables_active>N</variables_active>
        <lazy_conversion_active>N</lazy_conversion_active>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>245</xloc>
        <yloc>262</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>从目的表 [${destination_tablename}]</name>
        <type>TableInput</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <connection>${destination_dbname}</connection>
        <sql>SELECT
<#list columnValueList as columnValue>
<#if columnValue_index == 0>
  "${columnValue.destinationtableColumn}"
<#else>
, "${columnValue.destinationtableColumn}"
</#if>
</#list>
, "IMP_TIME"
, "ENTER_DEPT_ID"
, "IS_ACTIVE"
, "CREATOR"
, "CREATE_TIME"
, "UPDATOR"
, "UPDATE_TIME"
FROM "${destination_tablename}"
ORDER BY <#list keyMap?keys as key><#if key_index == 0>${key}<#else>, ${key}</#if></#list></sql>
        <limit>0</limit>
        <lookup/>
        <execute_each_row>N</execute_each_row>
        <variables_active>N</variables_active>
        <lazy_conversion_active>N</lazy_conversion_active>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>246</xloc>
        <yloc>406</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>内容路由</name>
        <type>SwitchCase</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <fieldname>flagfield</fieldname>
        <use_contains>Y</use_contains>
        <case_value_type>String</case_value_type>
        <case_value_format/>
        <case_value_decimal/>
        <case_value_group/>
        <default_target_step>空操作</default_target_step>
        <cases><case><value>new</value>
            <target_step>插入目的表 [${destination_tablename}]</target_step>
        </case><case><value>changed</value>
            <target_step>更新目的表 [${destination_tablename}]</target_step>
        </case></cases>     <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>642</xloc>
        <yloc>330</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>插入日志表 [${destination_tablename}_LOG]</name>
        <type>TableOutput</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <connection>${destination_dbname}</connection>
        <schema/>
        <table>${destination_tablename}_LOG</table>
        <commit>1000</commit>
        <truncate>N</truncate>
        <ignore_errors>N</ignore_errors>
        <use_batch>Y</use_batch>
        <specify_fields>Y</specify_fields>
        <partitioning_enabled>N</partitioning_enabled>
        <partitioning_field/>
        <partitioning_daily>N</partitioning_daily>
        <partitioning_monthly>Y</partitioning_monthly>
        <tablename_in_field>N</tablename_in_field>
        <tablename_field/>
        <tablename_in_table>Y</tablename_in_table>
        <return_keys>N</return_keys>
        <return_field/>
        <fields>
        </fields>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>1000</xloc>
        <yloc>330</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>插入目的表 [${destination_tablename}]</name>
        <type>TableOutput</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <connection>${destination_dbname}</connection>
        <schema/>
        <table>${destination_tablename}</table>
        <commit>1000</commit>
        <truncate>N</truncate>
        <ignore_errors>N</ignore_errors>
        <use_batch>Y</use_batch>
        <specify_fields>Y</specify_fields>
        <partitioning_enabled>N</partitioning_enabled>
        <partitioning_field/>
        <partitioning_daily>N</partitioning_daily>
        <partitioning_monthly>Y</partitioning_monthly>
        <tablename_in_field>N</tablename_in_field>
        <tablename_field/>
        <tablename_in_table>Y</tablename_in_table>
        <return_keys>N</return_keys>
        <return_field/>
        <fields>
            <#list columnValueList as columnValue>
            <field>
                <column_name>${columnValue.destinationtableColumn}</column_name>
                <stream_name>${columnValue.destinationtableColumn}</stream_name>
            </field>
            </#list>
            <field>
                <column_name>IMP_TIME</column_name>
                <stream_name>IMP_TIME</stream_name>
            </field>
            <field>
                <column_name>ENTER_DEPT_ID</column_name>
                <stream_name>ENTER_DEPT_ID</stream_name>
            </field>
            <field>
                <column_name>IS_ACTIVE</column_name>
                <stream_name>IS_ACTIVE</stream_name>
            </field>
            <field>
                <column_name>CREATOR</column_name>
                <stream_name>CREATOR</stream_name>
            </field>
            <field>
                <column_name>CREATE_TIME</column_name>
                <stream_name>CREATE_TIME</stream_name>
            </field>
            <field>
                <column_name>UPDATOR</column_name>
                <stream_name>UPDATOR</stream_name>
            </field>
            <field>
                <column_name>UPDATE_TIME</column_name>
                <stream_name>UPDATE_TIME</stream_name>
            </field>
        </fields>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>813</xloc>
        <yloc>240</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>更新目的表 [${destination_tablename}]</name>
        <type>Update</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <connection>${destination_dbname}</connection>
        <skip_lookup>Y</skip_lookup>
        <commit>1000</commit>
        <use_batch>N</use_batch>
        <error_ignored>N</error_ignored>
        <ignore_flag_field/>
        <lookup>
            <schema/>
            <table>${destination_tablename}</table>
            <#list keyMap?keys as key>
            <key>
                <name>${key}</name>
                <field>${key}</field>
                <condition>=</condition>
                <name2/>
            </key>
            </#list>
            <#list columnValueList as columnValue>
            <#if columnValue.isKey == 0>
            <value>
                <name>${columnValue.destinationtableColumn}</name>
                <rename>${columnValue.destinationtableColumn}</rename>
            </value>
            </#if>
            </#list>
            <value>
                <name>IS_ACTIVE</name>
                <rename>IS_ACTIVE</rename>
            </value>
            <value>
                <name>UPDATE_TIME</name>
                <rename>UPDATE_TIME</rename>
            </value>
        </lookup>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>814</xloc>
        <yloc>330</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>空操作</name>
        <type>Dummy</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>815</xloc>
        <yloc>423</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step>
        <name>记录合并</name>
        <type>MergeRows</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
        <partitioning>
            <method>none</method>
            <schema_name/>
        </partitioning>
        <#list keyMap?keys as key>
            <keys>
                <key>${key}</key>
            </keys>
        </#list>

        <values>
            <#list columnValueList as columnValue>
            <#if columnValue.isKey == 0>
            <value>${columnValue.destinationtableColumn}</value>
            </#if>
            </#list>
            <value>IS_ACTIVE</value>
        </values>
        <flag_field>flagfield</flag_field>
        <reference>从目的表 [${destination_tablename}]</reference>
        <compare>从源表 [${source_tablename}]</compare>
        <compare>
        </compare>
        <cluster_schema/>
        <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
        <xloc>463</xloc>
        <yloc>330</yloc>
        <draw>Y</draw>
    </GUI>
    </step>

    <step_error_handling>
    </step_error_handling>
    <slave-step-copy-partition-distribution>
    </slave-step-copy-partition-distribution>
    <slave_transformation>N</slave_transformation>
</transformation>
